package com.springark.ms.springarkgateway.api;

import com.springark.ms.commons.MsApiResult;
import com.springark.ms.commons.consts.SpringarkContentTypes;
import com.springark.ms.commons.consts.SpringarkRequestHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hankchan
 * @since 2019/5/10
 */
@RestController
public class ConcAPIs {

    @GetMapping(value = "/conc", produces = SpringarkContentTypes.APPLICATION_JSON)
    public MsApiResult mock(@RequestHeader(
            value = SpringarkRequestHeaders.REQUEST_ID, required = false) String requestId) {
        // 模拟网关接口处理时间为100ms
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return MsApiResult.newInstance().success("Mocking", requestId);
    }
}
